package com.feasy.generator.managedb.utils;

import io.github.yidasanqian.utils.JsonUtil;

import java.util.HashMap;

public class ResponseUtils<T>{
    /**
     * 0成功，1失败，默认为0.
     */
    private String status = "0";

    private T data = (T) new HashMap<>();

    private String message;

    public ResponseUtils() {
    }

    public ResponseUtils(String status, T data, String message) {
        this.status = status;
        this.data = data;
        this.message = message;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    @Override
    public String toString() {
        ResponseUtils responseUtils = new ResponseUtils(status, data, message);
        return JsonUtil.toJsonString(responseUtils);
    }

}
